package com.rlz.framemm.ui

import com.rlz.annotation.JudgeLogin
import com.rlz.annotation.Login
import com.rlz.base.base.BaseActivity
import com.rlz.base.base.EmptyModel
import com.rlz.base.base.EmptyViewModel
import com.rlz.base.cache.CacheManager
import com.rlz.base.cache.User
import com.rlz.framemm.R
import com.rlz.framemm.databinding.ActivityLoginBinding

/**
 * Created by RLZ
 * on 2021/12/2
 *
 */
@Login
class LoginActivity : BaseActivity<EmptyModel, EmptyViewModel, ActivityLoginBinding>() {
    override fun logic() {
        mBinding.login.setOnClickListener {
            val user = User();
            user.nickName = "我是用户名"
            CacheManager.Companion.manager.setUserInfo(user)
            toast("登录完成")
            finish()
        }
    }

    override fun layoutId(): Int {
        return R.layout.activity_login
    }


    companion object {
        @JudgeLogin
        @JvmStatic
        fun isLogin(): Boolean {
            return CacheManager.manager.getUserInfo() != null
        }
    }

}